package com.lizicloud.user.userupdate.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;

/**
 * 用户更新DTO - 适配前端用户更新功能
 * 支持状态字段更新，提供更完整的用户字段验证
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "用户更新信息 - 适配前端用户更新功能")
public class UserUpdateDTO {
    
    @Schema(description = "用户ID", required = true)
    @NotNull(message = "用户ID不能为空")
    private Long id;
    
    @Schema(description = "用户名", required = true)
    @NotBlank(message = "用户名不能为空")
    @Size(min = 2, max = 20, message = "用户名长度必须在2-20位之间")
    private String username;
    
    @Schema(description = "邮箱地址")
    @Email(message = "邮箱格式不正确")
    private String email;
    
    @Schema(description = "手机号码")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
    private String phone;
    
    @Schema(description = "用户角色", required = true)
    @NotBlank(message = "用户角色不能为空")
    @Pattern(regexp = "^(ADMIN|USER)$", message = "用户角色只能是ADMIN或USER")
    private String role;
    
    @Schema(description = "状态：1-启用，0-禁用", required = true)
    @NotNull(message = "状态不能为空")
    private Integer status;
    
    @Schema(description = "头像URL")
    private String avatar;
    
    @Schema(description = "备注信息")
    @Size(max = 500, message = "备注信息长度不能超过500字符")
    private String remark;
}